
package com.scalar.chiptrack.users.forms;

import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;

import com.scalar.chiptrack.ChipTrackActionForm;

public class UserProfileForm extends ChipTrackActionForm {
    
    private String m_oldPassword = null;
    private String m_newPassword = null;
    private String m_newPassword1 = null;
    
    private String m_firstName = null;
    private String m_lastName = null;
    private String m_phoneNumber = null;
    private String m_faxNumber = null;
    private String m_email = null;
    private String m_address1 = null;
    private String m_address2 = null;
    private String m_city = null;
    private String m_state = null;
    private String m_country = null;
    private String m_zipCode = null;
    private String m_receiveNotifications = "off";
    
    public String getOldPassword() {
        return m_oldPassword;
    }
    public void setOldPassword (String oldPassword) {
        m_oldPassword = oldPassword;
    }
    
    public String getNewPassword() {
        return m_newPassword;
    }
    public void setNewPassword (String newPassword) {
        m_newPassword = newPassword;
    }
   
    public String getNewPassword1() {
        return m_newPassword1;
    }
    public void setNewPassword1 (String newPassword1) {
        m_newPassword1 = newPassword1;
    }
    
    
    public String getFirstName() {
        return m_firstName;
    }
    public void setFirstName (String firstName) {
        m_firstName = firstName;
    }
    
    public String getLastName() {
        return m_lastName;
    }
    public void setLastName (String lastName) {
        m_lastName = lastName;
    }
    
    public String getPhoneNumber() {
        return m_phoneNumber;
    }
    public void setPhoneNumber (String phoneNumber) {
        m_phoneNumber = phoneNumber;
    }
    
    public String getFaxNumber() {
        return m_faxNumber;
    }
    public void setFaxNumber (String faxNumber) {
        m_faxNumber = faxNumber;
    }
    
    public String getEmail() {
        return m_email;
    }
    public void setEmail (String email) {
        m_email = email;
    }
    
    public String getAddress1() {
        return m_address1;
    }
    public void setAddress1 (String address1) {
        m_address1 = address1;
    }
    
    public String getAddress2() {
        return m_address2;
    }
    public void setAddress2 (String address2) {
        m_address2 = address2;
    }
    
    public String getCity() {
        return m_city;
    }
    public void setCity (String city) {
        m_city = city;
    }
    
    public String getState() {
        return m_state;
    }
    public void setState (String state) {
        m_state = state;
    }
    
    public String getCountry() {
        return m_country;
    }
    public void setCountry (String country) {
        m_country = country;
    }
    
    public String getZipCode() {
        return m_zipCode;
    }
    public void setZipCode (String zipCode) {
        m_zipCode = zipCode;
    }
    
    public String getReceiveNotifications() {
        return m_receiveNotifications;
    }
    public void setReceiveNotifications (String receiveNotifications) {
        m_receiveNotifications = receiveNotifications;
    }
    
     public ActionErrors validate (ActionMapping mapping, javax.servlet.http.HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();

        if ((m_oldPassword == null) || (m_oldPassword.trim().length() == 0)) {
            errors.add ("oldPassword", new ActionError("Old password required"));
            System.out.println ("Old password required");
        }

        // validation of other fields,... 
        // to be done.. 
        
        return errors;
    }
}